package com.conero.yangsu.mapper;

import com.conero.yangsu.entity.AdminEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;

import java.util.List;
import java.util.Optional;

// This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository
// CRUD refers Create, Read, Update, Delete
public interface AdminMapper extends CrudRepository<AdminEntity, Long> {
    List<AdminEntity> findAdminEntitiesByName(String name); // 根据名称查询所有用户

    // 根据id查用户
    Optional<AdminEntity> findById(Long id);

    // 根据装好查询ID
    AdminEntity findByAccount(String account);

    // 分页查询
    Page<AdminEntity> findAll(Pageable pageable);
}
